package com.czxy.dao;

import com.czxy.domain.Staff;
import com.czxy.domain.StaffVo;
import org.apache.ibatis.annotations.*;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

/**
 * @author zhangmengxiang1@itcast.cn
 * @version 1.0
 * @date 2020/2/3
 */
@org.apache.ibatis.annotations.Mapper
public interface StaffDao extends Mapper<Staff> {
    @Select("select * from hotel_staff")
    @Results({
            @Result(property = "roseid",column = "roseid"),
            @Result(property = "rose",column = "roseid",one = @One(select = "com.czxy.dao.RoseDao.selectByPrimaryKey"))
    })
    List<Staff> findAllStaffForpage(StaffVo staffVo);

    @Select("select * from hotel_staff where hid = #{hid}")
    @Results({
            @Result(property = "roseid",column = "roseid"),
            @Result(property = "rose",column = "roseid",one = @One(select = "com.czxy.dao.RoseDao.selectByPrimaryKey"))
    })
    Staff findOneStaffByhid(@Param("hid") Integer hid);

    @Select("select * from hotel_staff where username = #{username} and password = #{password}")
    Staff login(Staff staff);
}
